package com.wenjiang.consumer;


import com.wenjiang.common.dto.EmailSendParam;
import com.wenjiang.util.EmailUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 邮件发送的消费者
 */
@Slf4j
@Component
public class EmailConsumer {

    @Autowired
    EmailUtils emailUtils;

    //发送邮件
    @RabbitListener(queues = "emailQueue")
    public void sendEmail(EmailSendParam emailSendParam){
        log.info("准备发送邮件");
        emailUtils.SendEmail(emailSendParam.getContent(), emailSendParam.getTitle(), emailSendParam.getFileName(),
                emailSendParam.getEmail());

    }


}
